﻿using System;

namespace Isosceles_triangle
{
    class Program
    {
        ///<summary>
        ///输出一个等腰三角形
        ///</summary>
        ///<param  name="args"></param>
        static void Main(string[] args)
        {
            //初始化行数为-1
            int intN = -1;
            while (intN < 0)
            {
                Console.Write("请输入行数(0表示结束):");
                string strN = Console.ReadLine();
                //将输入的strN转换成int
                int.TryParse(strN, out intN);
            }
            if (intN > 0)  //输入正常
            {
                for (int i = 1; i <= intN; i++)
                {
                    for (int j = 1; j <=intN - i; j++)
                    {
                        Console.Write(" ");
                    }
                    for (int j=1;j<2*i;j++)
                    {
                    Console.Write("*");
                    }
                    Console.WriteLine("");
                }
            }
            //提示程序结束
            Console.WriteLine("按任意键结束...");
            Console.ReadKey();
        }
    }
}
